COMMON_DIR := $(shell ls -d */ | grep -Ev "^obj")
.PHONY: all $(COMMON_DIR)

# MY_MAIN_FUNCTION main函数编译所需库路径
export MY_MAIN_GCCOBJ:=$(shell pwd)/obj/gcc
export MY_MAIN_LINUXOBJ:=$(shell pwd)/obj/linux

# MY_MAIN_FUNCTION文件夹下各个文件的头文件目录
export MY_MAIN_FUNCTION_COMMON_INCLUDE := $(shell ls -d $(MAIN_Path)/function/common/*/ | sed 's/\// -I\//')
export MY_MAIN_FUNCTION_CMC_INCLUDE := $(shell ls -d $(MAIN_Path)/function/cmc/*/ | sed 's/\// -I\//')
export MY_MAIN_FUNCTION_MAIN_INCLUDE := $(shell ls -d $(MAIN_Path)/function/main/*/ | sed 's/\// -I\//')
export MY_MAIN_FUNCTION_TEST_INCLUDE := $(shell ls -d $(MAIN_Path)/function/test/*/ | sed 's/\// -I\//')

all:prepare $(COMMON_DIR) 
	@echo -e $(MY_SUCCESS)
	@echo "$(shell pwd) : all Success"
	@echo -e $(AC_NULL)		
clean:
	@for dir in $(COMMON_DIR);do\
		$(MAKE) -C $$dir clean;\
	done
	@echo -e $(MY_SUCCESS)
	@echo "$(shell pwd) : clean Success"
	@echo -e $(AC_NULL)	

prepare:
	mkdir -p $(MAIN_Path)/obj/linux
	mkdir -p $(MAIN_Path)/obj/gcc
	
$(COMMON_DIR):
	@echo "Entering directory $@"
	$(MAKE) -C $@	